<%@ page contentType="text/html;charset=UTF-8" language="java" pageEncoding="UTF-8" %>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<div class="bjui-pageContent" style="top: 0; bottom: 32px;">
<form id="payer_save_form_id" method="post">
    <div class="bjui-row col-2">
        <input type="hidden" name="id" value="${savePayer.id}">

        <p>
            <label class="row-label">名称</label>
            <span class="datagrid-dialog-column-span">
                <input type="text" name="name" value="${savePayer.name}" data-rule="required">
            </span>
        </p>


        <label class="row-label">类型</label>
        <div class="row-input">
            <select data-toggle="type" name="type">
                <option value="0" <c:if test="${savePayer.type eq 0}">selected ="selected"</c:if> >托管</option>
                <option value="1" <c:if test="${savePayer.type eq 1}">selected ="selected"</c:if> >非托管</option>
            </select>
        </div>

        <p>
            <label class="row-label">标识</label>
            <span class="datagrid-dialog-column-span">
                <input type="text" name="nid" value="${savePayer.nid}" data-rule="required">
            </span>
        </p>

        <p>
           <label class="row-label">提交信息url</label>
            <span class="datagrid-dialog-column-span">
               <input type="text" name="submitUrl" value="${savePayer.submitUrl}" data-rule="required">
            </span>
        </p>

        <p>
           <label class="row-label">接收信息url</label>
            <span class="datagrid-dialog-column-span">
               <input type="text" name="receiveUrl" class="input-nm" value="${savePayer.receiveUrl}" data-rule="required">
            </span>
        </p>

        <p>
            <label class="row-label">接收页面信息url</label>
            <span class="datagrid-dialog-column-span">
               <input type="text" name="receivePageUrl" class="input-nm" value="${savePayer.receivePageUrl}" data-rule="required">
            </span>
        </p>

        <label class="row-label">状态</label>
        <div class="row-input">
            <select data-toggle="status" name="status">
                <option value="true" <c:if test="${empty savePayer.status || savePayer.status}">selected ="selected"</c:if> >开启</option>
                <option value="false" <c:if test="${!empty savePayer.status  && !savePayer.status}">selected ="selected"</c:if> >关闭</option>
            </select>
        </div>
    </div>
</form>
</div>
<div class="bjui-pageFooter">
    <ul>
        <li><button type="button" class="btn btn-red cancel" onclick="BJUI.dialog('closeCurrent');" data-icon="remove"><i class="fa fa-remove"></i> 取消</button></li>
        <li><button type="button" class="btn btn-default save" onclick="payerSave();" data-icon="save"><i class="fa fa-save"></i> 保存</button>
        </li>
    </ul>
</div>
<script>

    /**
     * 提交保存信息
     */
    function payerSave(){
        BJUI.ajax('ajaxform', {
            url: '/admin/payer/save',
            form: $("#payer_save_form_id"),
            validate: true,
            loadingmask: true,
            callback: function(response, options) {
                BJUI.dialog('closeCurrent');
                if (response.haveError) {
                    BJUI.alertmsg('error', response.errMsg, {
                        okCall: function () {
                            BJUI.navtab('refresh')
                        }
                    });

                } else {
                    BJUI.alertmsg('ok', response.data, {
                        okCall: function () {
                            BJUI.navtab('refresh')
                        }
                    });
                }
            }
        });
    }
</script>